package org.bluedream.core.module.dao.fixed;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.bluedream.core.module.entity.bill.stkOut.StkBack;
import org.bluedream.core.module.entity.fixed.Fixed;

import java.io.Serializable;

/**
 * @ClassName FixedDao
 * @Description TODO
 * @Author Administrator
 * @Data 16:28
 * @Version
 */
public interface FixedDao extends BaseMapper<Fixed> {
    @Override
    @Select("select fixed.location_type as locationType , fixed.SKU_LOCATION as skuLocation , fixed.check_date as checkDate , check_by as checkBy , " +
            "fixed.CARD_NUM as cardNum , " +
            "fixed.code as code , fixed.barcode as barcode , fixed.oprice as oprice , depItemUser.name as name" +
            " depItemUser.id as \"depItemUser.id\" , depItemUser.code as \"depItemUser.code\" , depItemUser.name as \"depItemUser.name\"" +
            " fixed.id as id , fixed.create_by as createBy , fixed.create_date as createDate , fixed.update_by as updateBy , fixed.update_date as updateDate , fixed.status as status , fixed.remarks as remarks " +
            " from tFixed fixed , vFixedLocation b , depItemUser depItemUser" +
            "${ew.customSqlSegment} and fixed.LOCATION_TYPE = b.LOCATION_TYPE and fixed.SKU_LOCATION = b.id")
    IPage<Fixed> selectPage(IPage<Fixed> page, @Param("ew") Wrapper<Fixed> queryWrapper);

    @Override
    @Select("select fixed.location_type as locationType , fixed.SKU_LOCATION as skuLocation , fixed.check_date as checkDate , check_by as checkBy , " +
            "fixed.CARD_NUM as cardNum , " +
            "fixed.code as code , fixed.barcode as barcode , fixed.oprice as oprice , depItemUser.name as name" +
            " depItemUser.id as \"depItemUser.id\" , depItemUser.code as \"depItemUser.code\" , depItemUser.name as \"depItemUser.name\"" +
            " fixed.id as id , fixed.create_by as createBy , fixed.create_date as createDate , fixed.update_by as updateBy , fixed.update_date as updateDate , fixed.status as status , fixed.remarks as remarks " +
            " from tFixed fixed , vFixedLocation b , depItemUser depItemUser" +
            "where fixed.id = #{id} and fixed.LOCATION_TYPE = b.LOCATION_TYPE and fixed.SKU_LOCATION = b.id")
    Fixed selectById(Serializable id);
}
